#include "SFMLRectangleShape.h"
#include "..\ScaleFactor.h"

using namespace vn;

SFMLRectangleShape::SFMLRectangleShape(float p_layer) : SFMLDrawable(p_layer)
{ m_rectangleShape.setScale(SCALEF, SCALEF); }
SFMLRectangleShape::~SFMLRectangleShape(void){}

void SFMLRectangleShape::draw(sf::RenderWindow& p_renderWindow)
{
	p_renderWindow.draw(m_rectangleShape);
}

void SFMLRectangleShape::draw(sf::RenderTexture& p_renderTexture)
{
	p_renderTexture.draw(m_rectangleShape);
}

void SFMLRectangleShape::setSize(const vn::Vector2& p_size)
{
	m_size = p_size;
	m_rectangleShape.setSize(sf::Vector2f(p_size.x, p_size.y));
}

void SFMLRectangleShape::setFillColor(const vn::Color& p_fillColor)
{
	m_fillColor = p_fillColor;
	m_rectangleShape.setFillColor(sf::Color(p_fillColor.r, p_fillColor.g, p_fillColor.b, p_fillColor.a));
}

void SFMLRectangleShape::setOutlineColor(const vn::Color& p_outlineColor)
{
	m_outLineColor = p_outlineColor;
	m_rectangleShape.setOutlineColor(sf::Color(p_outlineColor.r, p_outlineColor.g, p_outlineColor.b, p_outlineColor.a));
}

void SFMLRectangleShape::setOutlineThickness(float p_outlineThickness)
{
	m_rectangleShape.setOutlineThickness(p_outlineThickness);
}

void SFMLRectangleShape::setPosition(float p_x, float p_y)
{
	m_position.x = p_x;
	m_position.y = p_y;
	m_rectangleShape.setPosition(p_x * SCALEF, p_y * SCALEF);
}

void SFMLRectangleShape::setPosition(const vn::Vector2& p_position)
{
	m_position = p_position;
	m_rectangleShape.setPosition(p_position.x * SCALEF, p_position.y * SCALEF);
}

void SFMLRectangleShape::setRotation(float p_rotation)
{
	m_rectangleShape.setRotation(p_rotation);
}

void SFMLRectangleShape::setScale(const vn::Scale& p_scale)
{
	m_scale = p_scale;
	m_rectangleShape.setScale(p_scale.x * SCALEF, p_scale.y);
}

void SFMLRectangleShape::setScale(float p_x, float p_y)
{
	m_scale.x = p_x;
	m_scale.y = p_y;
	m_rectangleShape.setScale(p_x * SCALEF, p_y * SCALEF);
}

void SFMLRectangleShape::setOrigin(float p_x, float p_y)
{
	m_origin.x = p_x;
	m_origin.y = p_y;
	m_rectangleShape.setOrigin(p_x, p_y);
}

void SFMLRectangleShape::setOrigin(const vn::Vector2& p_origin)
{
	m_origin = p_origin;
	m_rectangleShape.setOrigin(p_origin.x, p_origin.y);
}

void SFMLRectangleShape::setDoRender(bool p_value)
{
	m_render = p_value;
}

const vn::Color& SFMLRectangleShape::getFillColor()
{
	return m_fillColor;
}

const vn::Color& SFMLRectangleShape::getOutlineColor()
{
	return m_outLineColor;
}

float SFMLRectangleShape::getOutlineThickness()
{
	return m_rectangleShape.getOutlineThickness();
}

const vn::Vector2& SFMLRectangleShape::getPosition()
{
	return m_position;
}

const vn::Scale& SFMLRectangleShape::getScale()
{
	return m_scale;
}

const vn::Vector2& SFMLRectangleShape::getOrigin()
{
	return m_origin;
}

const vn::Vector2& SFMLRectangleShape::getSize()
{
	return m_size;
}